let num1 = location.href.split("=")[2];
console.log(num1);
let title = decodeURI((location.href.split("=")[1]).split('&')[0]);
console.log(decodeURI(title));
renderNav(num1, title)

function renderNav(num1, num2) {
    ajax({
        url: "http://chst.vip:1234/api/getproduct",
        data: {
            productid: num1,
            categoryId: num2
        },
        success(res) {
            let navHtml2 = "";
            let infoHtml = "";
            let makepriceHtml = "";
            res.result.forEach(item => {
                navHtml2 += `
            <a href="index.html">首页></a>
            <a href="category.html">全部分类></a>
            <a href="bijia.html?category=${item.categoryId}&title=${item.category}">${num2}></a>
            <a href="">${item.productName.substr(0,10)}</a>
            <a href="" id="botton" class="fr">筛选</a>
                `
                infoHtml += `
                <div class="pic">${item.productImg}</div>
                <div class="title">${item.productName}</div>
                <div class="container"></div>`
                makepriceHtml += `${item.bjShop}`
            });
            $('#subNav').html(navHtml2);
            $('#info').html(infoHtml);
            $('#makeprice').html(makepriceHtml);
        }
    })
    ajax({
        url: "http://chst.vip:1234/api/getproductcom",
        data: { productid: num1 },
        success(res) {
            let commentHtml = "";
            res.result.forEach(item => {
                commentHtml += `
                <div class="content_div">
                    <div class="up"><span>${item.comName}</span><span>${item.comTime}</span></div>
                    <div class="comments">${item.comContent}</div>
                    <div class="down"><span>${item.comFrom}</span></div>
                </div>
                `
            });
            $('#content').html(commentHtml);
        }
    })
}